package com.java.base.exercise.current;

import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @Author RenPu
 * @Date 2021/10/8 17:16
 * @Version 1.0
 * @Description: 堆OOM实例代码, java.lang.OutOfMemoryError᧶Java heap space
 **/
public class HeapOOM {

    static class OOMObject {
    }

    public static void main(String[] args) {
        List<OOMObject> objects = Collections.synchronizedList(new ArrayList<OOMObject>());
        while (true) {
            objects.add(new OOMObject());
        }
    }
}
